package com.xplay.xpocker.room;

import com.xplay.xpocker.entity.RoomUserDTO;
import com.xplay.xpocker.mapper.GameRuRoomUserMapper;
import com.xplay.xpocker.observer.ChannelHandlerManager;
import com.xplay.xpocker.util.ObjectUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Configuration
public class InitRoomCache {

    @Resource
    private GameRuRoomUserMapper roomUserMapper;


    /**
     * 如果，我是说如果有一天这里有1w桌
     * 加载4w的数据...
     */


    @PostConstruct
    public void initAllUser() {
        /*log.debug("加载用户在房间的信息");
        List<RoomUserDTO> allUsers = roomUserMapper.allRoomUser(null);
        if (ObjectUtils.notEmpty(allUsers)) {
            for (RoomUserDTO roomUser : allUsers) {
                ChannelHandlerManager.getInstance().addRoom(roomUser.getCode(), roomUser.getUserId());
            }
        }*/
    }
}
